#ifndef _TWITTER_RESOURCE_TIMELINE_H_
#define _TWITTER_RESOURCE_TIMELINE_H_
#include "Object.h"

NS_BEGIN(Twit)
NS_BEGIN(Resource)
NS_BEGIN(Timeline)

/**
* @brief 
*  Returns the 20 most recent statuses, including retweets if they exist, from non-protected users.
*  The public Timeline is cached for 60 seconds. Requesting more frequently than that 
*  will not return any more data, and will count against your rate limit usage.
*/
struct PublicTimeline:public OStatusesVStatuses
{
	PublicTimeline(IOAuth& o):OStatusesVStatuses(o,"public_timeline"){
		setConstraints(false,true);
	}
};


struct HomeTimeline:public OStatusesVStatuses
{
	HomeTimeline(IOAuth& o):OStatusesVStatuses(o,"home_timeline"){
		setConstraints(true,true);
	}

   /**
   * @brief 
   *  Returns results with an ID greater than (that is, more recent than) the specified ID. 
   *  There are limits to the number of Tweets which can be accessed through the API. 
   *  If the limit of Tweets has occured since the since_id, 
   *  the since_id will be forced to the oldest ID available.
   * @param id If string is empty unset parameter.
   */
	void setSinceID(std::string id){ setParam("since_id",id.c_str()); }

   /**
   * @brief Returns results with an ID less than (that is, older than) or equal to the specified ID.
   */
	void setmaxID(std::string id){ setParam("max_id", id.c_str()); }

   /**
   * @brief Specifies the number of records to retrieve. Must be less than or equal to 200(retweeted_by_* 100)
   */
	virtual void setCount(size_t count){ setParam("count",(int)count); }

   /**
   * @brief Specifies the page of results to retrieve.
   */
	void setPage(size_t page){ setParam("page",(int)page); }
};

/**
* @brief 
*  Returns the 20 most recent statuses posted by the authenticating user and the user's they follow. 
*  This is the same Timeline seen by a user when they login to twitter.com.
*  This method is identical to statuses/HomeTimeline, except that this method will only include retweets 
*  if the include_rts parameter is set. 
*  The RSS and Atom responses will always include retweets as statuses prefixed with RT.
*  This method is can only return up to 800 statuses. 
*  If include_rts is set only 800 statuses, including retweets if they exist, can be returned.
*/
struct FriendsTimeline:public HomeTimeline
{
	FriendsTimeline(IOAuth& o):HomeTimeline(o){
		setConstraints(true,true);
		setFile("friends_timeline");
	}

   /**
   * @brief When set to either true, t or 1,the Timeline will contain native retweets 
   *  (if they exist) in addition to the standard stream of tweets. 
   *  The output format of retweeted tweets is identical to the representation you see in HomeTimeline. 
   *  Note: If you're using the trim_user parameter in conjunction with include_rts, 
   *  the retweets will still contain a full user Object.
   */
	void setIncludeRts(bool include_rts){ setParam("include_rts", include_rts); }
};

/**
* @brief 
*  Returns the 20 most recent statuses posted by the authenticating user. 
*  It is also possible to request another user's Timeline by using the screen_name or user_id parameter. 
*  The other users Timeline will only be visible if they are not protected, 
*  or if the authenticating user's follow request was accepted by the protected user.
*  The Timeline returned is the equivalent of the one seen when you view a user's profile on twitter.com.
*  This method is can only return up to 3200 statuses. 
*  If include_rts is set only 3200 statuses, including retweets if they exist, can be returned.
*  This method will not include retweets in the XML and JSON responses unless 
*  the include_rts parameter is set. The RSS and Atom responses will always include 
*   retweets as statuses prefixed with RT.
*/
struct UserTimeline:public FriendsTimeline
{
	UserTimeline(IOAuth& o):FriendsTimeline(o){
		setFile("user_timeline");
		setConstraints(false,true);
	}

   /**
   * @brief The ID of the user for whom to return results for. 
   *  Helpful for disambiguating when a valid user ID is also a valid screen name.
   */
	void setUserId(Value::UniqueID userId){ setParam("user_id",userId.toString().c_str()); }

   /**
   * @brief The screen name of the user for whom to return results for. 
   *  Helpful for disambiguating when a valid screen name is also a user ID.
   */
	void setScreenName(std::string screen_name){ setParam("screen_name", screen_name.c_str()); }
};

/**
* @brief 
*  Returns the 20 most recent Mentions (statuses containing @username) for the authenticating user.
*  The Timeline returned is the equivalent of the one seen when you view your Mentions on twitter.com.
*  This method is can only return up to 800 statuses. If include_rts is set only 800 statuses, 
*  including retweets if they exist, can be returned.
*  This method will not include retweets in the XML and JSON responses unless 
*  the include_rts parameter is set. The RSS and Atom responses will always 
*  include retweets as statuses prefixed with RT.
*/
struct Mentions:public FriendsTimeline
{
	Mentions(IOAuth& o):FriendsTimeline(o){
		setFile("mentions");
		setConstraints(true,true);
	}
};


/**
* @brief Returns the 20 most recent retweets posted by the authenticating user.
*/
struct RetweetedByMe:public HomeTimeline
{
	RetweetedByMe(IOAuth& o):HomeTimeline(o){
		setFile("retweeted_by_me");
		setConstraints(true,true);
	}
};

/**
* @brief Returns the 20 most recent retweets posted by users the authenticating user follow.
*/
struct RetweetedToMe:public HomeTimeline
{
	RetweetedToMe(IOAuth& o):HomeTimeline(o){
		setFile("retweeted_to_me");
		setConstraints(true,true);
	}
};

/**
* @brief Returns the 20 most recent tweets of the authenticated user that have been retweeted by others.
*/
struct RetweetsOfMe:public HomeTimeline
{
	RetweetsOfMe(IOAuth& o):HomeTimeline(o){
		setFile("retweets_of_me");
		setConstraints(true,true);
	}
};
NS_END;

DeclareResourceClass(CTimeline)
CTimeline(IOAuth& o):PublicTimeline(o), HomeTimeline(o), FriendsTimeline(o), UserTimeline(o), Mentions(o),
RetweetedByMe(o), RetweetedToMe(o), RetweetsOfMe(o){}
public:
Timeline::PublicTimeline   PublicTimeline;
Timeline::HomeTimeline     HomeTimeline;
Timeline::FriendsTimeline  FriendsTimeline;
Timeline::UserTimeline     UserTimeline;
Timeline::Mentions         Mentions;
Timeline::RetweetedByMe    RetweetedByMe;
Timeline::RetweetedToMe    RetweetedToMe;
Timeline::RetweetsOfMe     RetweetsOfMe;
EndResourceClass;
   NS_END;
NS_END;
#endif /*_TWITTER_RESOURCE_TIMELINE_H_*/

